﻿using System;
using System.Collections.Generic;
using System.Text;

namespace OkTool.Regex
{
    /// <summary>
    /// 常用正则表达式字符串池
    /// </summary>
    public abstract class RegexPool
    {
        /// <summary>
        /// 数字
        /// </summary>
        public const string NUMBERS = "\\d+";

        /// <summary>
        /// IP v4
        /// <para>采用分组方式便于解析地址的每一个段</para>
        /// </summary>
        public const string IPV4 = "^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)$";

        /// <summary>
        /// 生日
        /// </summary>
        public const string BIRTHDAY = "^(\\d{2,4})([/\\-.年]?)(\\d{1,2})([/\\-.月]?)(\\d{1,2})日?$";

        /// <summary>
        /// IP v6
        /// </summary>
        public const  string IPV6 = "(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]+|::(ffff(:0{1,4})?:)?((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1?[0-9])?[0-9])\\.){3}(25[0-5]|(2[0-4]|1?[0-9])?[0-9]))";

        /// <summary>
        /// 货币
        /// </summary>
        public const string MONEY = "^(\\d+(?:\\.\\d+)?)$";

        /// <summary>
        /// 匹配金钱
        /// </summary>
        public const string Money2 = "(-?[0-9,]+)(\\.[0-9]+)?";

        /// <summary>
        /// 移动电话
        /// <para>中国大陆： +86  180 4953 1399，2位区域码标示+11位数字</para>
        /// <para> 中国大陆 +86 Mainland China</para>
        /// </summary>
        public const string MOBILE = "(?:0|86|\\+86)?1[3-9]\\d{9}";

        /// <summary>
        /// 中国香港移动电话
        /// <para>中国香港： +852 5100 4810， 三位区域码+10位数字, 中国香港手机号码8位数</para>
        /// </summary>
        public const string MOBILE_HK = "(?:0|852|\\+852)?\\d{8}";

        /// <summary>
        /// 中国台湾移动电话
        /// <para>中国台湾： +886 09 60 000000， 三位区域码+号码以数字09开头 + 8位数字, 中国台湾手机号码10位数</para>
        /// <para>中国台湾 +886 Taiwan 国际域名缩写：TW</para>
        /// </summary>
        public const string MOBILE_TW = "(?:0|886|\\+886)?(?:|-)09\\d{8}";

        /// <summary>
        /// 中国澳门移动电话
        /// <para>中国澳门： +853 68 00000， 三位区域码 +号码以数字6开头 + 7位数字, 中国澳门手机号码8位数</para>
        /// <para>中国澳门 +853 Macao 国际域名缩写：MO</para>
        /// </summary>
        public const string MOBILE_MO = "(?:0|853|\\+853)?(?:|-)6\\d{7}";

        /// <summary>
        /// 座机号码
        /// </summary>
        public const string TEL = "(010|02\\d|0[3-9]\\d{2})-?(\\d{6,8})";

        /// <summary>
        /// 座机号码+400+800电话
        /// </summary>
        public const string TEL_400_800 = "0\\d{2,3}[\\- ]?[1-9]\\d{6,7}|[48]00[\\- ]?[1-9]\\d{2}[\\- ]?\\d{4}";

        /// <summary>
        /// 18位身份证号码
        /// </summary>
        public const string CITIZEN_ID = "[1-9]\\d{5}[1-2]\\d{3}((0\\d)|(1[0-2]))(([012]\\d)|3[0-1])\\d{3}(\\d|X|x)";

        /// <summary>
        /// URL
        /// </summary>
        public const string URL = "[a-zA-Z]+://[\\w-+&@#/%?=~_|!:,.;]*[\\w-+&@#/%=~_|]";

        /// <summary>
        /// 时间正则
        /// </summary>

        public const string TIME = "\\d{1,2}:\\d{1,2}(:\\d{1,2})?";
    }
}
